  function [pdf,logpdf]= multnorm_simple(x,mu,prec, ldetprec); 
% ===============================================================
% MULTNORM_SIMPLE 
% Pdf and Log PDF of a multivariant normal with mean MU and 
% PRECISION PREC  
%
%  function [pdf,logpdf]= multnorm_simple(x,mu,prec, ldetprec); 
%
% Can pass on LDETPREC the LOG determinant of the precision 
% 
% Alejandro Justiniano 
% ================================================================
x=x(:); 
mu=mu(:); 
if nargin < 4 
    ldetprec = mydet( prec ) 
end 
dev = x - mu; 
ft =(dev')*prec*dev ;

%ldetprec has a positive sign for being the log determinant of the precision 
logpdf = 0.5*( ldetprec  - length(x)*log( 2*pi ) -ft  ); 
pdf = exp( logpdf ); 
